<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>path/motion planning</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../index.html" TARGET="_top"><img src="images/homeImg.png"></a></p>



<h1>Path/motion planning</h1>

<p>CoppeliaSim offers path/motion planning functionality via a plugin wrapping the <a href="http://ompl.kavrakilab.org/">OMPL library</a>. The plugin, courtesy of Federico Ferri, exports several <a href="simOMPL.htm?view=alphabetical">API functions related to OMPL</a>. Its source code can be found <a href="https://github.com/CoppeliaRobotics/simExtOMPL" target="_blank">here</a>.</p>

<p>Following points should be considered when preparing a path/motion planning task:</p>

<li>Decide of a start and goal state. When the path planning object is a serial manipulator, a goal pose (or end-effector position/orientation) is often provided instead of a goal state. In that case function <a href="simIK.htm#simIK.getConfigForTipPose">simIK.getConfigForTipPose</a> can be used to find one or several goal states that satisfy the provided goal pose.</li>
<li>Create a path planning task with <a href="simOMPL.htm#createTask">simOMPL.createTask</a>.</li>
<li>Select an algorithm with <a href="simOMPL.htm#setAlgorithm">simOMPL.setAlgorithm</a>.</li>
<li>Create the required state space, which can be composed as a compound object: <a href="simOMPL.htm#createStateSpace">simOMPL.createStateSpace</a> and <a href="simOMPL.htm#setStateSpace">simOMPL.setStateSpace</a>.</li>
<li>Specify which entities are not allowed to collide with <a href="simOMPL.htm#setCollisionPairs">simOMPL.setCollisionPairs</a>.</li>
<li>Specify the start and goal state with <a href="simOMPL.htm#setStartState">simOMPL.setStartState</a> and <a href="simOMPL.htm#setGoalState">simOMPL.setGoalState</a>.</li>
<li>Call <a href="simOMPL.htm#setup">simOMPL.setup</a> once to initialize OMPL's data structures.</li>
<li>Compute one (or more) paths with <a href="simOMPL.htm#compute">simOMPL.compute</a>; when called multiple times it will reuse previously computed data, if the chosen algorithm supports it, e.g.: multi-query planners such as PRM.</li>
<li>Destroy the path planning task with <a href="simOMPL.htm#destroyTask">simOMPL.destroyTask</a>.</li>
<li>Often, path planning is used in combination with <a href="kinematics.htm">inverse kinematics</a>: in a pick-and-place task for instance, the final approach should usually be a straight-line path, which can be generated with <a href="simIK.htm#simIK.generatePath">simIK.generatePath</a>.</li>

<p>Above procedure is the <em>regular</em> approach, which sometimes lacks flexibility. Additionally, following callback functions can be set-up:</p>

<li><a href="simOMPL.htm#setStateValidationCallback">simOMPL.setStateValidationCallback</a></li>
<li><a href="simOMPL.htm#setProjectionEvaluationCallback">simOMPL.setProjectionEvaluationCallback</a></li>
<li><a href="simOMPL.htm#setGoalCallback">simOMPL.setGoalCallback</a></li>

<h3>Path optimality</h3>

<p>Most of the planners use randomized algorithms, which don't provide optimal (i.e. shortest) paths. Some of those are <em>optimizing</em> planners, meaning that they are still randomized, but will use the remaining planning time to improve the first solution found, thus giving an <em>asymptotic optimality</em> guarantee.</p>

<p>If a short path is preferable, then an optimizing planner (such as RRT*, PRM*, ...) should be used.</p>

<h3>Multi-query planners</h3>

<p>When using multi-query planners (PRM, PRM*, ...), just call <a href="simOMPL.htm#setStartState">simOMPL.setStartState</a> and <a href="simOMPL.htm#compute">simOMPL.compute</a> again. Planning will re-use and expand the previously built roadmap.</p>

<p>&nbsp;</p>

<p>Make sure to refer to following demo scenes for additional details:</p>

<li><em>scenes/kinematics/8-computingJointAnglesForRandomPoses.ttt</em></li>
<li><em>scenes/3DoFHolonomicPathPlanning.ttt</em></li>
<li><em>scenes/6DoFHolonomicPathPlanning.ttt</em></li>
<li><em>motionPlanningDemo1</em></li>
<li><em>motionPlanningAndGraspingDemo.ttt</em></li>

<br>
<br>
 </tr>
</table> 
</div>  
  
  
</body>

</html>
